package com.yx.config;

import com.yx.interceptor.DynamicDataSourceAnnotationInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Classname WebMVCConfig
 * @Date 2021/07/21 17:17
 * @Author by yx
 * @Description TODO:
 */
@Configuration
public class WebMVCConfig implements WebMvcConfigurer {
    @Autowired
    private DynamicDataSourceAnnotationInterceptor dynamicDataSource;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry
                .addInterceptor(dynamicDataSource)
                .addPathPatterns("/**");
    }
}
